﻿<Window x:Class="CandyMergeTool.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:internals="clr-namespace:CandyMergeTool.Internals"
        Title="CandyMergeTool" Height="350" Width="300" Topmost="True" ResizeMode="NoResize" >
    
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="B2VConverter" />
        <internals:InvertBooleanConverter x:Key="InvertBConverter" />
        <internals:InvertBooleanToVisibilityConverter x:Key="InvertB2VConverter" />
    </Window.Resources>
    
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <StackPanel Orientation="Horizontal">
            <Button Content="Find CandyCrush" Width="100" Command="{Binding FindCandyCrushCommand}" />
            <TextBlock Text="CandyCrush was not found!" Foreground="Red" VerticalAlignment="Center" Margin="5, 0, 0, 0" Visibility="{Binding CandyCrushFound, Converter={StaticResource InvertB2VConverter}}" />
            <TextBlock Text="CandyCrush was found!" Foreground="Green" VerticalAlignment="Center" Margin="5, 0, 0, 0" Visibility="{Binding CandyCrushFound, Converter={StaticResource B2VConverter}}" />
        </StackPanel>

        <GroupBox Header="Detection" Grid.Row="1">
            <Grid  Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal" Margin="0, 0, 0, 5">
                    <Button Content="Detect!" Width="100" Command="{Binding DetectCombinationCommand}" Margin="0, 0, 5, 0" IsEnabled="{Binding AutoDetection, Converter={StaticResource InvertBConverter}}" />
                    <CheckBox Content="Auto-detection" VerticalAlignment="Center" IsEnabled="{Binding CandyCrushFound}" IsChecked="{Binding AutoDetection}" Command="{Binding AutoDetectCombinationCommand}" />
                </StackPanel>
                <Button Content="Reset" Command="{Binding ResetCommand}" Width="100" Grid.Row="1" HorizontalAlignment="Left" />
            </Grid>
        </GroupBox>

    </Grid>
</Window>
